package cc.rengu.igas.share.facade.bean.cups;

import cc.rengu.oltp.service.common.enums.OltpRpcdEnum;
import cc.rengu.oltp.service.model.BizException;

import java.util.Arrays;

/**
 * 域104 MU Tag01 业务类型
 *
 * @author yangfan
 * @version 1.0
 * @date 2021/5/7
 */
@SuppressWarnings("AlibabaEnumConstantsMustHaveComment")
public enum F104_MU_01_BusiTypeEnum {
    _00("00", "未定义（用于填写缺省值）"),
    _01("01", "取现"),
    _02("02", "公转私转账"),
    _03("03", "公转公转账"),
    ;

    private String code;
    private String desc;

    F104_MU_01_BusiTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public String toString() {
        return code + "-" + desc;
    }

    public static F104_MU_01_BusiTypeEnum find(String code) {
        F104_MU_01_BusiTypeEnum result = Arrays.stream(F104_MU_01_BusiTypeEnum.values())
                .filter(e -> e.getCode().equals(code)).findFirst().orElse(null);

        if (result == null) {
            throw new BizException(OltpRpcdEnum.PARAM_IS_EMPTY_OR_NULL.getRespCode(), "找不到对应的枚举信息" + code);
        }
        return result;
    }
}
